package com.dongdong.zhuangji.controller.utils;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author dongdong 抖音号：W13883155245
 * @version 1.0
 * @date 2025/5/4
 * @description 全局异常处理器
 */
//@ControllerAdvice
@RestControllerAdvice
public class ProjectExceptionAdvice {
    //拦截所有的异常消息
    @ExceptionHandler(value = Exception.class)
    public R doException(Exception e) {
        //记录日志
        //通知运维
        //通知开发
         e.printStackTrace();

        return new R(false,"服务器故障",e.getMessage());
    }
}
